/**
 * Created by zhaott on 2017/11/14.
 */
var fs=require('fs');
var data='';
//创建可读流
var readStream=fs.createReadStream('readStream.js');
//设置字符编码
readStream.setEncoding('utf-8');
//处理data事件
readStream.on('data',function (chunk) {
    data+=chunk;
});
//处理end事件
readStream.on('end',function () {
    console.log(data);
})
//处理error事件
readStream.on('error',function (err) {
    console.log(err.stack);
});
//处理finish事件
readStream.on('finish',function () {
    console.log("&finish^");
})
console.log("程序执行完毕");